// 
// Decompiled by Procyon v0.5.36
// 

package com.orange.boot.dev2.controller;

import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import com.orange.boot.dev2.entity.DiseaseInformation;
import org.springframework.web.bind.annotation.DeleteMapping;
import com.orange.boot.dev2.entity.vo.CatalogueVO;
import java.util.List;
import com.orange.boot.dev2.entity.vo.DiseasePictureNameVO;
import com.orange.boot.dev2.entity.vo.ShowDiseaseInfoVO;
import org.springframework.web.bind.annotation.GetMapping;
import io.swagger.annotations.ApiOperation;
import com.orange.boot.dev2.entity.vo.BrowseParamsVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.orange.boot.utils.R;
import org.springframework.web.bind.annotation.RequestParam;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import com.orange.boot.dev2.service.DiseaseInformationService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"/dev2/disease-information"})
@Api(
        tags = {"疾病防治"}
)
public class DiseaseInformationController {
    @Autowired
    DiseaseInformationService diseaseInformationService;

    public DiseaseInformationController() {
    }

    @ApiOperation("疾病预览----分页显示疾病")
    @GetMapping({"/browse"})
    public R browse(@ApiParam("页面数") @RequestParam("pageNum") Integer pageNum, @ApiParam("页面大小") @RequestParam("pageSize") Integer pageSize) {
        Page<BrowseParamsVO> browse = this.diseaseInformationService.browse(pageNum, pageSize);
        return R.ok().data("browse", browse);
    }

    @ApiOperation("疾病预览----分页模糊加多级查询疾病")
    @GetMapping({"/browseLike"})
    public R browseLike(@ApiParam("页面数") @RequestParam("pageNum") Integer pageNum, @ApiParam("页面大小") @RequestParam("pageSize") Integer pageSize, @ApiParam("疾病中文名称") @RequestParam(value = "diseaseChineseName",required = false,defaultValue = "") String diseaseChineseName, @ApiParam("疾病类型") @RequestParam(value = "disasterTypeId",required = false,defaultValue = "") String disasterTypeId, @ApiParam("疾病部位") @RequestParam(value = "citrusPartId",required = false,defaultValue = "") String citrusPartId) {
        Page<BrowseParamsVO> browse = this.diseaseInformationService.browseLike(pageNum, pageSize, diseaseChineseName, disasterTypeId, citrusPartId);
        return R.ok().data("browse", browse);
    }

    @ApiOperation("疾病预览、图文诊断、目检诊断 ----根据病名id 显示柑橘详情")
    @GetMapping({"/showDiseaseInformation"})
    public R showDiseaseInformation(@ApiParam("疾病主键") @RequestParam("diseaseId") String diseaseId) {
        ShowDiseaseInfoVO showDiseaseInfoVO = this.diseaseInformationService.showDiseaseInformation(diseaseId);
        return R.ok().data("showDiseaseInfoVO", showDiseaseInfoVO);
    }

    @ApiOperation("图文诊断--分页显示图文")
    @GetMapping({"showDiseasePicture"})
    public R showDiseasePictureName(@ApiParam("页面数") @RequestParam("pageNum") Integer pageNum, @ApiParam("页面大小") @RequestParam("pageSize") Integer pageSize) {
        Page<DiseasePictureNameVO> diseasePictureNameVOPage = this.diseaseInformationService.showDiseasePictureName(pageNum, pageSize);
        return R.ok().data("diseasePictureNameVOPage", diseasePictureNameVOPage);
    }

    @ApiOperation("图文诊断--模糊查询")
    @GetMapping({"diseaseLike"})
    public R diseaseLike(@ApiParam("疾病名称") @RequestParam("diseaseChineseName") String diseaseChineseName) {
        List<ShowDiseaseInfoVO> showDiseaseInfoVO = this.diseaseInformationService.diseaseForNameLike(diseaseChineseName);
        return R.ok().data("showDiseaseInfoVO", showDiseaseInfoVO);
    }

    @ApiOperation("图文诊断--分页模糊查询+多级查询")
    @GetMapping({"diseaseSelect"})
    public R diseaseSelect(@ApiParam("页面数") @RequestParam("pageNum") Integer pageNum, @ApiParam("页面大小") @RequestParam("pageSize") Integer pageSize, @ApiParam("疾病中文名称") @RequestParam(value = "diseaseChineseName",required = false,defaultValue = "") String diseaseChineseName, @ApiParam("疾病分类") @RequestParam(value = "disasterTypeId",required = false) String disasterTypeId, @ApiParam("柑橘部位") @RequestParam(value = "citrusPartId",required = false) String citrusPartId) {
        Page<DiseasePictureNameVO> diseasePictureNameVOPage = this.diseaseInformationService.diseaseSelect(pageNum, pageSize, diseaseChineseName, disasterTypeId, citrusPartId);
        return R.ok().data("diseasePictureNameVOPage", diseasePictureNameVOPage);
    }

    @ApiOperation("目录诊断----显示疾病特征")
    @GetMapping({"/catalogue"})
    public R catalogue(@ApiParam("疾病类型") @RequestParam(value = "disasterTypeId",required = false,defaultValue = "") String disasterTypeId, @ApiParam("疾病部位") @RequestParam(value = "citrusPartId",required = false,defaultValue = "") String citrusPartId) {
        List<CatalogueVO> catalogue = this.diseaseInformationService.catalogue(disasterTypeId, citrusPartId);
        return R.ok().data("catalogue", catalogue);
    }

    @ApiOperation("根据id逻辑删除")
    @DeleteMapping({"/delete"})
    public R logicDelete(@ApiParam("疾病id") @RequestParam("diseaseId") String diseaseId) {
        return this.diseaseInformationService.logicDelete(diseaseId);
    }

    @ApiOperation("增添疾病信息")
    @PostMapping({"/add"})
    public R addDiseaseInformation(@RequestBody DiseaseInformation diseaseInformation) {
        return this.diseaseInformationService.addDiseaseInformation(diseaseInformation);
    }

    @ApiOperation("修改疾病信息")
    @PutMapping({"/update"})
    public R updateDiseaseInformation(@RequestBody DiseaseInformation diseaseInformation) {
        return this.diseaseInformationService.updateDiseaseInformation(diseaseInformation);
    }
}